import request from '../utils/request';


export const fetchData = (query) => {
    return request({
        url: './table.json',
        method: 'get',
        params: query
    });
};


export const getUser = query => {
    return request({
        url: 'user/queryall',
        method: 'post',
        params: query
    });
};
export const selectMemberMes = query => {
    return request({
        url: 'Manager/selectAllMes',
        method: 'post',
        params: query
    });
};
export const selectLike = query => {
    return request({
        url: 'Manager/selectLike',
        method: 'post',
        params: query
    });
};
export const selectTransactionPriceByMemberid = query => {
    return request({
        url: 'agent/selectTransactionPriceByMemberid',
        method: 'post',
        params: query
    });
};
export const selectTransactionPriceByMemberidLike = query => {
    return request({
        url: 'agent/selectTransactionPriceByMemberidLike',
        method: 'post',
        params: query
    });
};
export const getAgent = query => {
    return request({
        url: 'agent/byreference',
        method: 'get',
        params: query
    });
};

export const updateAgent = query => {
	return request({
		url: 'agent/updateendtime',
		method: 'get',
		params : query
	})
};

export const deleteOne = query => {
	return request({
		url: 'agent/delete',
		method: 'get',
		params: query
	})
};

export const getLevel = query => {
	return request({
		url: 'level/selectAll',
		method: 'get',
		params: query
	})
};

export const selectLevel = query => {
	return request({
		url:'agent/selectByLevel',
		method: 'get',
		params : query
	})
}

export const selectUsername = query => {
	return request({
		url:'agent/selectUsername',
		method:'get',
		params:query
	})
};

export const getRole = query => {
    return request({
            url: 'role/selectAll',
            method: 'post',
            params: query
    });
};

export const getAllRole = query => {
    return request({
            url: 'role/selectAllNoPage',
            method: 'get',
            params: query
    });
};

export const searchRole = query => {
    return request({
            url: 'role/selectOne',
            method: 'post',
            params: query
    });
    
};

export const deleteRole = query => {
    return request({
            url: 'role/delete',
            method: 'post',
            params: query
    });
    
};

export const deleteRoles = query => {
    return request({
            url: 'role/batchDelete',
            method: 'post',
            params: query
    });
    
};

export const modifyRole = query => {
    return request({
            url: 'role/update',
            method: 'post',
            params: query
    });
};

export const addUser = param => {
    return request({
        url: '/user/reguser',
        method: 'post',
        params: param
    });
};
export const login = param => {
    return request({
        url: '/user/login',
        method: 'post',
        params: param
    });
};export const allTransaction = query => {
	return request({
		url: '/agent/selecttransactionall',
		method: 'get',
		params: query
	})
};

//未完成
export const changeUserRole = query => {
    axios.post("http://localhost:8080/user/changerole", 
	qs.stringify(query,
    	{ indices: false }))
};

export const loginmsg = param => {
    return request({
        url: '/loginmsg/selectAll',
        method: 'post',
        params: param
    });
};

export const searchLoginmsg = param => {
    return request({
        url: '/loginmsg/selectByTime',
        method: 'post',
        params: param
    });
};

export const advice = param => {
    return request({
        url: '/advice/selectAll',
        method: 'post',
        params: param
    });
};

export const modifyAdvice = query => {
    return request({
            url: 'advice/update',
            method: 'post',
            params: query
    });
};

export const searchAdvice = param => {
    return request({
        url: '/advice/selectByTime',
        method: 'post',
        params: param
    });
};

export const advicePending = param => {
    return request({
        url: '/advice/advicePending',
        method: 'post',
        params: param
    });
};

export const getBalance = param => {
    return request({
        url: '/agent/getbalance',
        method: 'get',
        params: param
    });
};

export const drawBalance = param => {
    return request({
        url: '/agent/drawbalance',
        method: 'post',
        params: param
    });
};

export const changeprofit = param => {
    return request({
        url: '/level/changeprofit',
        method: 'post',
        params: param
    });
};

export const allBanner = query => {
	return request({
		url: '/banner/all',
		method: 'get',
		params: query
	})
};

export const addBanner = query => {
	return request({
		url: '/banner/add',
		method: 'get',
		params :query
	})
};

export const updateBanner = query => {
	return request({
		url: '/banner/update',
		method: 'get',
		params :query
	})
};

export const deleteBanner = query => {
	return request({
		url: '/banner/delete',
		method: 'get',
		params :query
	})
};

export const byUsername = query => {
    return request({
        url : '/agent/selecttransactionbyname',
        method : 'get',
        params : query
    })
};

export const selectAllBankMes = query => {
    return request({
        url : '/bank/selectAllBankMes',
        method : 'get',
        params : query
    })
};

export const selectBankLike = query => {
    return request({
        url : '/bank/selectBankLike',
        method : 'get',
        params : query
    })
};

export const deleteBank = query => {
    return request({
        url : '/bank/deleteBank',
        method : 'get',
        params : query
    })
};

export const updateBank = query => {
    return request({
        url : '/bank/updateBank',
        method : 'get',
        params : query
    })
};
export const addBank = query => {
    return request({
        url : '/bank/addBank',
        method : 'get',
        params : query
    })
};
export const addAdvice = query => {
    return request({
        url : '/advice/addAdvice',
        method : 'get',
        params : query
    })
};

export const exportLoginmsg = param => {
    return request({
        url: '/loginmsg/export',
        method: 'post',
        params: param
    });
};

export const addtransaction = form => {
    return request({
        url : '/transaction/addtransaction',
        method : 'post',
        params : form
    })
};

export const getNameAndId = form => {
    return request({
        url : '/transaction/getallname',
        method : 'get',
        params : form
    })
};

export const searchTitle = query => {
    return request({
        url:'/banner/searchTitle',
        method:'post',
        params:query
    })
};

export const yearMoney = query => {
    return request({
        url:'/agent/year',
        method:'get',
        params:query
    })
};

export const logout = query => {
    return request({
        url:'/user/logout',
        method:'get',
        params:query
    })
};

export const getLoginData = query => {
    return request({
        url:'/user/getlogindata',
        method:'get',
        params:query
    })
};

export const getTotal = query => {
    return request({
        url:'/user/gettotal',
        method:'get',
        params:query
    })
};

export const usedBanner = query => {
	return request({
		url: '/banner/selectUsed',
		method: 'post',
		params: query
	})
};
export const levelNum = query => {
	return request({
		url: '/agent/levelNum',
		method: 'post',
		params: query
	})
};
export const deleteUser = query => {
	return request({
		url: '/user/delete',
		method: 'get',
		params: query
	})
};